package com.appleyk.controller;


import com.appleyk.relation.Recomm;
import com.appleyk.service.RecommService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 建立关系
 */
@RestController
@RequestMapping("/sys/Recomm")
public class RecommController {


    @Autowired
    private RecommService recommService;

    /**
     *
     * @param id 发送用户的ID  映射在路径上
     * @param name 填写者名字
     * @param uid 填写者ID
     * @param sex 填写这姓名
     * @param age 填写者age
     * @param hobbies 填写者 爱好
     * @return
     */
    @PostMapping("/insert/{id}")
    public String create(@PathVariable("id")Long id,
            @RequestParam("name")String name,@RequestParam("uid") Long uid,
                         @RequestParam("sex") String sex,@RequestParam("age") Integer age,@RequestParam("hobbies") List<String> hobbies){
        return recommService.setCreateLikes( id, name, uid, sex, age, hobbies);
    }

    /**
     * 根据ID 进行查询2-3级的 路径
     * @param id
     * @return
     */
    @PostMapping("/get/{id}")
    public    List<Recomm> getRecomm(@PathVariable("id")Long id){
        System.out.println("进入了get/id");
        return recommService.getRecomms(id);
    }





}
